import request from '@/utils/request'
import Cookies from 'js-cookie'


// 发放列表
export function getList(data,page) {
    return request({
        url: '/Wx_welfare/welfare_list/'+(page?page:1),
        method: 'post',
        data: data
    })
}
// 发放分页
export function getPage(data) {
    return request({
        url: '/Wx_welfare/welfare_list_page',
        method: 'post',
        data: data
    })
}
// 获取商品、优惠券
export function getGoodsList(data,page) {
    return request({
        url: '/Wx_welfare/get_coupons_list/'+(page?page:1),
        method: 'post',
        data: data
    })
}
// 获取商品、优惠券分页
export function getGoodsPage(data) {
    return request({
        url: '/Wx_welfare/get_coupons_list_page',
        method: 'post',
        data: data
    })
}
// 创建发放任务
export function grantCreate(data) {
    return request({
        url: '/Wx_welfare/welfare_modify',
        method: 'post',
        data: data
    })
}
// 结束发放任务
export function grantOver(data) {
    return request({
        url: '/Wx_welfare/set_welfare_status',
        method: 'post',
        data: data
    })
}
// 发放任务详情
export function grantInfo(data) {
    return request({
        url: '/Wx_welfare/welfare_info',
        method: 'post',
        data: data
    })
}
// 发放任务修改
export function grantEdit(data) {
    return request({
        url: '/Wx_welfare/welfare_edit',
        method: 'post',
        data: data
    })
}
// 是否可新建新人专享
export function canNew(data) {
    return request({
        url: '/Wx_welfare/get_new_order',
        method: 'post',
        data: data
    })
}
// 手机号导入
export function importPhone(data) {
    return request({
        url: '/Wx_send_management/welfare_import_phone',
        method: 'post',
        data: data
    })
}
// 手机号导出
export function getExport(data) {
    window.location.href = `https://${location.host}/smsi/index.php/Wx_send_management/valid_export_excel?welfare_id=${data.welfare_id}&didixueshengka=${Cookies.get('SMS_AdminToken')}`; 
}
